<ui:composition template="/WEB-INF/templates/main-template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

	<ui:define name="sidebar">
		<ui:include src="/WEB-INF/templates/public-sidebar.xhtml" />
	</ui:define>
	<ui:define name="content">
		<h:form>
		<p:growl id="growl"></p:growl>
			<h:outputText value="#{msg['domesticprojectassignment.lable.heading']}" styleClass="outputTextTitle" style="font-weight: bold; color: #7892B7" />
			<br />
			<br />
			<h:panelGrid style="width: 100%; text-align: left; ">
		    <p:scrollPanel style="width: 800px;height:300px"> 
		    	<p:dataTable id="domesticProjectAssignmentViewEditTable" style="width: 100%" value="#{domesticProjectAssignmentsListBean.projectAssignmentsList}" var="row" 
    					 	paginator="true" rows="10"  
               				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
               				rowsPerPageTemplate="5,10,15">
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['projectassignmentid.lable']}" />
						</f:facet>
							<h:outputText value="#{row.projectAssignmentCode}" /> 
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['projectname.label']}" />
						</f:facet>
						<h:outputText value="#{row.project.projectName}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['clientname.label']}" />
						</f:facet>
						<h:outputText value="#{row.project.client}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['clientlocation.label']}" />
						</f:facet>
						<h:outputText value="#{row.project.clientLocation}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['createdate.label']}" />
						</f:facet>
						<h:outputText  value="#{row.createDate}" >
						<f:convertDateTime pattern="dd/MM/yyy"/>
						</h:outputText>
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['recommenderstatus.lable']}" />
						</f:facet>
						<h:outputText value="#{row.recommendationStatus}" />
					</p:column>
					<p:column>
						<f:facet name="header">
							<h:outputText value="#{msg['approverstatus.lable']}" />
						</f:facet>
						<h:outputText value="#{row.approvalStatus}" />
					</p:column>
					<p:column style="width: 66px; text-align: center;">
						<f:facet name="header">
							<h:outputText value="View/Update" />
						</f:facet>
						
					<p:commandButton id="editview"  icon="ui-icon-search" action="#{domesticProjectAssignmentsListBean.viewProjectAssignmentInEditMode}" oncomplete="EditProjectAssignmentDialog.show()" update="@form" >
						<f:setPropertyActionListener target="#{domesticProjectAssignmentsListBean.projectAssignment}" value="#{row}"></f:setPropertyActionListener>
					</p:commandButton>
					</p:column>
					
			</p:dataTable>
			</p:scrollPanel>
			</h:panelGrid>
			
			<!-- VIEW/EDIT PROJECT ASSIGNMENT FORM -->
			
			<p:dialog header="VIEW/UPDATE PROJECT ASSIGNMENT" widgetVar="EditProjectAssignmentDialog" id="EditProjectAssignmentDialog" resizable="false">
			<p:scrollPanel style="height:300px; width:600px;" scrollMode="native">  
			<h:panelGrid  style="border: 1px solid #d9d9d9; width: 100%; padding-bottom: 20px;">
				
				<h:outputLabel value="#{msg['employeedetails.label']}" styleClass="outputTextSubTitle"  />
				<h:panelGrid columns="6" columnClasses="grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned,grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned" 
							 style="border: 1px solid #d9d9d9; width: 100%">  
				
					<h:outputLabel value="#{msg['projectassignmentid.lable']}"/>
					<h:outputLabel value=" : " />
					<p:inputText value="#{domesticProjectAssignmentsListBean.projectAssignment.projectAssignmentCode}" readonly="true"/> 
					<h:outputLabel value="#{msg['createdate.label']}" />
					<h:outputLabel value=" : " />
					<p:calendar value="#{domesticProjectAssignmentsListBean.projectAssignment.createDate}"  showButtonPanel="true"/>
						
					<h:outputLabel value="#{msg['employeename.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText  readonly="true" value="#{domesticProjectAssignmentsListBean.projectAssignment.employee.firstName} #{domesticProjectAssignmentsListBean.projectAssignment.employee.lastName}"/>
					<h:outputLabel value="#{msg['employeeid.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText value="#{domesticProjectAssignmentsListBean.projectAssignment.employee.employeeCode}" readonly="true"/> 
									
					<h:outputLabel value="#{msg['contactnumber.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText value="#{domesticProjectAssignmentsListBean.projectAssignment.contactNumber}"  />
					<h:outputLabel value="#{msg['emergenceycontactnum.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText value="#{domesticProjectAssignmentsListBean.projectAssignment.emergencycontactNumber}" />  
	                <h:outputLabel value="#{msg['approvedby.lable']}"/>
	                <h:outputLabel value=" : " />
					<p:inputText  value="#{domesticProjectAssignmentsListBean.projectAssignment.approvedBy}"  readonly="true"/>
						
	
				</h:panelGrid>
				
				<h:outputLabel value="#{msg['assignmentdetails.label']}" styleClass="outputTextSubTitle"  />
				<h:panelGrid columns="6" columnClasses="grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned,grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned" 
							 style="border: 1px solid #d9d9d9; width: 100%">
				
					<h:outputText value="Choose Your Project" />
					<h:outputLabel value=" : " /> 
					<p:selectOneMenu value="#{domesticProjectAssignmentsListBean.projectAssignment.project.projectId}" style="width:140px;">
					<f:selectItems value="#{domesticProjectAssignmentsListBean.projectsMap}" />
					<p:ajax event="change" listener="#{domesticProjectAssignmentsListBean.projectChangeListener}" update="projectName,clientAddress,client,clientLocation,contactPerson,contactNumber,periodFrom,periodTo,recommendedBy"/>
					</p:selectOneMenu>
					<h:outputLabel value="#{msg['recommendedby.lable']}"/>
					<h:outputLabel value=" : " />
					<p:inputText id="recommendedBy" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.owner.firstName} #{domesticProjectAssignmentsListBean.projectAssignment.project.owner.lastName}" readonly="true"/>  
					
					
					<h:outputLabel value="#{msg['projectname.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText id="projectName" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.projectName}" readonly="true"/> 					 	
					<h:outputLabel value="#{msg['clientaddress.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText id="clientAddress" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.clientAddress}"  readonly="true"/>
					
					<h:outputLabel value="#{msg['clientname.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText  id="client" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.client}" readonly="true"/>
					<h:outputLabel value="#{msg['clientlocation.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText  id="clientLocation" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.clientLocation}" readonly="true"/> 
					
										
					<h:outputLabel value="#{msg['clientcontactperson.label']}"/>
					<h:outputLabel value=" : " />
					<p:inputText id="contactPerson"  value="#{domesticProjectAssignmentsListBean.projectAssignment.project.contactPerson}"  readonly="true"/>
					<h:outputLabel value="#{msg['clientcontactnumber.lable']}"/>
					<h:outputLabel value=" : " />
					<p:inputText  id="contactNumber" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.contactNumber}" readonly="true"/>
					
					
					<h:outputLabel value="#{msg['projectstratdate.label']}"/>
					<h:outputLabel value=" : " />
					<p:calendar id="periodFrom" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.periodFrom}"  showButtonPanel="true" disabled="true"/>
					<h:outputLabel value="#{msg['projectenddate.label']}"/>
					<h:outputLabel value=" : " />
					<p:calendar id="periodTo" value="#{domesticProjectAssignmentsListBean.projectAssignment.project.periodTo}"  showButtonPanel="true" disabled="true"/>
				</h:panelGrid>
				
				<h:outputLabel value="#{msg['assignmentallowancedetails.label']}" styleClass="outputTextSubTitle"  />
				<h:panelGrid columns="6" columnClasses="grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned,grid90pxCellMiddleLeftAligned,gridCellMiddleLeftAligned" 
							 style="border: 1px solid #d9d9d9; width: 100%">
					
					<h:outputLabel value="#{msg['dailyallowance.lable']}"/>
					<h:outputLabel value=" : " />					 
	                <p:inputMask id="dailyAllowance" mask="99999.99" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.dailyAllowance}"  >
		                  <f:convertNumber minIntegerDigits="5" minFractionDigits="2" />
		                  <p:watermark for="dailyAllowance" value="00000.00" />
		            </p:inputMask>   
					<h:outputLabel value="#{msg['advanceamount.lable']}"/>
	       			<h:outputLabel value=" : " />
				   	<p:inputMask mask="99999.99" id="advanceAmount" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.advanceAmount}">
							<f:convertNumber minIntegerDigits="5" minFractionDigits="2" />
	 						<p:watermark for="advanceAmount" value="00000.00" />
							<p:ajax event="change" listener="#{domesticProjectAssignmentsListBean.advanceAmountChangeListener}" update="totalAmount"/>
					</p:inputMask> 
					
					<h:outputLabel value="#{msg['advanceamountbydate.lable']}"/>
					<h:outputLabel value=" : " />
					<p:calendar value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.advanceByDate}" showButtonPanel="true" />
					
					<h:outputLabel value="#{msg['paymentcycle.lable']}"/>
					<h:outputLabel value=" : " />
					<p:calendar value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.paymentCycleDate}" showButtonPanel="true" />
	              
					<h:outputLabel value="Additionals"/>
					<h:outputLabel value=" : " />					
					<p:selectOneMenu id="options" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.additionals}"  style="width:140px;">
				 			<f:selectItem itemLabel="Select Additional"/>
				         	<f:selectItem itemLabel="By ERPandERP" itemValue="By ERPandERP"/>  
							<f:selectItem itemLabel="By Client" itemValue="By Client" />    
                    </p:selectOneMenu> 
					
					<h:outputLabel value="#{msg['roomrentadvance.lable']}"/>
					<h:outputLabel value=" : " />
					<p:inputMask mask="99999.99" id="roomRentAdvance" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.roomRentAdvance}"  >
					<f:convertNumber minIntegerDigits="5" minFractionDigits="2" />
					<p:watermark for="roomRentAdvance" value="00000.00" />
					<p:ajax event="change" listener="#{domesticProjectAssignmentsListBean.roomRentAdvanceChangeListener}" update="totalAmount"/>
					</p:inputMask>
					
					<h:outputLabel value="#{msg['roomrentpermonth.lable']}"/>
					<h:outputLabel value=" : " />
					<p:inputMask mask="99999.99" id="roomRentPerMonth" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.roomRentPerMonth}"  >
					<f:convertNumber minIntegerDigits="5" minFractionDigits="2" />
					<p:watermark for="roomRentPerMonth" value="00000.00" />
					</p:inputMask>
					<h:outputLabel value="#{msg['totalamount.lable']}"/>
					<h:outputLabel value=" : " />
					 <p:inputMask mask="99999.99" id="totalAmount" value="#{domesticProjectAssignmentsListBean.projectAssignmentDetail.totalAdvance}" >
							<f:convertNumber minIntegerDigits="5" minFractionDigits="2" />
							<p:watermark for="totalAmount" value="00000.00" />
					</p:inputMask>
					
				</h:panelGrid>
				
			</h:panelGrid>
			
			</p:scrollPanel>
		
		        <h:panelGrid columns="1" style=" width:95%">
		<h:panelGroup style="float:right;">
					<p:commandButton id="updateButton" rendered="#{domesticProjectAssignmentsListBean.renderUpdate}" update="growl" value="Update" action="#{domesticProjectAssignmentsListBean.updateDomesticProjectAssignment}" />
		        	<p:commandButton id="updateDisableButton" rendered="#{domesticProjectAssignmentsListBean.renderDisableUpdate}" update="growl" value="Update" action="#{domesticProjectAssignmentsListBean.updateDomesticProjectAssignment}" disabled="true" />
		        	<p:commandButton id="closeButton" process="@this" value="Close" actionListener="#{domesticProjectAssignmentsListBean.dialogClose}" ajax="false"/>
    	</h:panelGroup> 
    
	
	</h:panelGrid>
		        
			</p:dialog>	
		 
		</h:form>
	</ui:define>
</ui:composition>

